package com.bwie.controller;

import com.bwie.common.domain.Users;
import com.bwie.common.domain.request.UserRequest;
import com.bwie.common.result.Result;
import com.bwie.service.AuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private AuthService authService;

    //手机号
    @GetMapping("/phone/{tel}")
    public Result<Users> phone(@PathVariable String tel){
        authService.phone(tel);
        return Result.success();
    }

    //登录
    @PostMapping("/login")
    public Result<Users> login(@RequestBody Users user){
        UserRequest u = authService.login(user);
        return Result.success(u);
    }

}
